﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace com.dz.ct.ui
{
    public partial class FrmBook : Form
    {

        /// <summary>
        /// 书籍列表地址
        /// </summary>
        public string BookUrl { get; set; }

        /// <summary>
        /// 开始页码
        /// </summary>
        public int StartPageIndex { get; set; }

        /// <summary>
        /// 结束页码
        /// </summary>
        public int EndPageIndex { get; set; }

        string m_book_url = string.Empty;

        public FrmBook()
        {
            InitializeComponent();
        }

        public FrmBook(string i_book_url)
        {
            m_book_url = i_book_url;
            InitializeComponent();
        }

      
        /// <summary>
        /// 确定操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSure_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUrl.Text.Trim()))
            {
                MessageBox.Show("请输入小说列表地址", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            BookUrl = txtUrl.Text.Trim();
            int pageIndex = 1;
            if (!int.TryParse(txtStartPageIndex.Text.Trim(), out pageIndex))
                pageIndex = 1;
            StartPageIndex = pageIndex;
            if (!int.TryParse(txtEndPageIndex.Text.Trim(), out pageIndex))
                pageIndex = 1;
            EndPageIndex = pageIndex;
            this.DialogResult = DialogResult.OK;
            this.Close();

        }

        private void FrmBook_Load(object sender, EventArgs e)
        {
            txtUrl.Text = m_book_url;
        }
    }
}
